(
    function () {
        //首页地图
        var myCharts = echarts.init(document.getElementById("myMap"))

        myCharts.setOption({
    title: {
        text: '房价',
        left: 'center'
    },
    tooltip: {
        trigger: 'item'
    },
    visualMap: {
        type: 'piecewise',
        pieces: [
            {min: 500, max: 1500, label: '价格正常1'},
            {min: 1501, max: 2500, label: '价格偏高'},
            {min: 2501, max: 4000, label: '价格高'}
        ]
    },
    roamController: {
        show: true,
        left: 'right',
        mapTypeControl: {
            'china': true
        }
    },
    series: [
        {
            name: '平均值',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: []
        }
    ]
});
        $(function () {
            setInterval(chian_up,5000)
            function chian_up() {
                $.get('http://127.0.0.1:5000/index/map'.done(function (result_data) {
                    myCharts.setOption({
                        series: {
                            name:"租房平均价格",
                            data:result_data.area
                        }
                    })
                }))
            }
        });
    }
)();